import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesDefectiveReview/export`;
// 分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesDefectiveReview`,
    method: "get",
    params,
  });
}
// 新增
export function rowCreate(data = {}) {
  return request({
    url: `${mesUrl}mesDefectiveReview`,
    method: "post",
    data,
  });
}
// 修改
export function rowUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesDefectiveReview`,
    method: "put",
    data,
  });
}
// 删除
export function rowDel(id) {
  return request({
    url: `${mesUrl}mesDefectiveReview/${id}`,
    method: "put",
  });
}
// 详情
export function rowDetail(id) {
  return request({
    url: `${mesUrl}mesDefectiveReview/info/${id}`,
    method: "get",
  });
}

// 导入用户
export function importData(data = {}) {
  return request({
    url: `${mesUrl}mesDefectiveReview/import`,
    method: "POST",
    data,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}
// 下载模板
export const downloadTemplateUrl = `${mesUrl}mesDefectiveReview/template`;

// 查询评审状态-数据字典（0-未开始，1-进行中，2-完成）列表
export function getReviewStatusList() {
  return request({
    url: `${adminUrl}dict/type/mes_review_status`,
    method: "get",
  });
}
// 查询评审结果-数据字典（让步接收、返工返修、报废）列表
export function getReviewResultList() {
  return request({
    url: `${adminUrl}dict/type/mes_review_result`,
    method: "get",
  });
}

// 获取评审列表详情
export function mesDefectiveReviewInfo(id) {
  return request({
    url: `${mesUrl}mesDefectiveReview/info/${id}`,
    method: "get",
  });
}
// 新增或修改部门评审意见
export function mesDefectiveReviewComment(data) {
  return request({
    url: `${mesUrl}mesDefectiveReviewComment`,
    method: "post",
    data,
  });
}
// 最终评审意见
export function commitReview(data) {
  return request({
    url: `${mesUrl}mesDefectiveReview/commitReview`,
    method: "post",
    data,
  });
}
// 缺陷等级
export function getDefectLevelList() {
  return request({
    url: `${adminUrl}dict/type/defect_level`,
    method: "get",
  });
}
